package homework24;

public abstract class BeverageDecorator extends Beverage{//抽象装饰类

}

class Milk extends BeverageDecorator {
    Beverage beverage;//抽象构件对象...

    public Milk(Beverage beverage){//具体抽象类的构造方法..
        this.beverage = beverage;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription() + "牛奶";//描述装饰方法
    }

    @Override
    public int getCost() {
        return 6 + beverage.getCost();//描述装饰方法
    }

}

class Mocha extends BeverageDecorator{
    Beverage beverage;

    public Mocha(Beverage beverage) {
        this.beverage = beverage;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription() + "摩卡" + "\t" ;
    }

    @Override
    public int getCost() {
        return 10 +beverage.getCost();
    }

}

class Whip extends BeverageDecorator{
    Beverage beverage;

    public Whip(Beverage beverage) {
        this.beverage = beverage;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription() +"奶泡";
    }
    @Override
    public int getCost() {
        return 8 + beverage.getCost();
    }
}
